import { _decorator, Component, Node } from 'cc';
import { ModuleBase } from '../Card/ModuleBase';
import { Joker } from '../Card/Joker';
import { JokerEffectData } from '../Card/EffectBase';
const { ccclass, property } = _decorator;

@ccclass('JokerMgr')
export class JokerMgr extends ModuleBase {
    Jokers:Map<string,Joker>=new Map();
    onInit(...rest: any[]): void {
        //清空
        this.Jokers.clear();
        //将小丑牌加入数组
        for(let child of this.node.children){
            if(child.name=="Bg"){
                continue;
            }
            let childts=child.children[1].getComponent(Joker);
            this.Jokers.set(child.name,childts);
        }
    }
    callCard(data:JokerEffectData){
        for(let jokercard of Array.from(this.Jokers.values())){
            //小丑牌激活效果
            jokercard.activateEffect(data);            
        }
    }
}


